;(function($){
	$.lintul=function(url,data,call){
		$.post(url,data,function(msg){
			if(msg.status!==-1){
				call(msg);
			}else{
				 layer.msg('抱歉，请重新登录', { offset: '15%', icon: 5 }, function () {
                            window.location.href = '/login';
                        });
			}
		},'json');
	}
})($)

//admin
//忘记密码提示
function loss(t) { layer.tips('请联系管理员', $(t), { tips: 1 }); };
function login() {
            var $num = $('#num'); var $pwd = $('#pwd');
            if ($num.val().trim() === '') {
                $num.focus();
                layer.tips('请输入账号', $num);
                return;
            }
            if ($pwd.val().trim() === '') {
                $pwd.focus();
                layer.tips('请输入密码', $pwd);
                return;
            }
//            if ($('#rmbpwd').is(':checked')) {
//                $.AMUI.store.set('cwnu_glxy_inof', { n: window.decodeURI($num.val()), p: window.decodeURI($pwd.val()) });
//            } else {
//                $.AMUI.store.remove('cwnu_glxy_inof');
//            }
            $.AMUI.progress.start();
            $.lintul('/login/check', { num: $num.val().trim(), pwd: $.md5($pwd.val().trim()) }, function (data) {
				console.log(data)
				switch(data.status){
					case 1:
						layer.tips('登陆成功', '#btnLogin');
	                    setTimeout(function () {
	                    	window.location.href = '/admin';
	                  	}, 2000);
						break;
					case 0:
						$num.focus();
                    	$num.val('');
                    	$pwd.val('');
                   		layer.tips('用户名不存在', $num);
						break;
					case 2:
						$pwd.focus();
                        $pwd.val('');
                    	layer.tips('密码输入错误', $pwd);
						break;
					case 3:
						layer.msg('该账户被管理员锁定', { offset: '15%', icon: 5 }, function () {
                            window.location.href = '/login';
                        });
						break;
					case 4:
					layer.msg('密码错误达3次，该账户被锁定30分种', { offset: '15%', icon: 5 }, function () {
                            window.location.href = '/login';
                        });
						break;
				}
                $.AMUI.progress.done();
            });
        }



